decoder: Decouple each validator into its own type #297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of these changes are primarily to improve readability and composability of the logic, as we anticipate more rules to be added in the future and existing rules to become more complex as a result of schema extensions in #290
We may end up with two different interfaces for external validators, where in one case the validator reacts to various nodes in the AST and in the other case processes some higher level context, like collected references. So this new interface should be useful externally too at some point, but not for the reference-based validation rule we plan to implement as part of #288
It is possible that we'll need to either modify or re-implement
MergeBlockBodySchemas
as part of #291 but we will cross that bridge when we come to it.